package cc.rengu.redp.bizimpl.upmp.service.impl;

import cc.rengu.redp.bizimpl.upmp.domain.QrcodeInfo;
import cc.rengu.redp.bizimpl.upmp.dao.QrcodeInfoMapper;
import cc.rengu.redp.bizimpl.upmp.service.IQrcodeInfoService;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 刘玉亮.LL
 */
@Service
@DS("upmp")
public class QrcodeInfoServiceImpl extends ServiceImpl<QrcodeInfoMapper, QrcodeInfo> implements IQrcodeInfoService {

    @Override
    public List<QrcodeInfo> selectQrCode(String qr_status, String instId) {
        LambdaQueryWrapper<QrcodeInfo> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(QrcodeInfo::getInstId, instId).eq(QrcodeInfo::getQrStatus, qr_status);
        return baseMapper.selectList(wrapper);
    }

    @Override
    public QrcodeInfo selectByQrCode(String qrCode) {
        LambdaQueryWrapper<QrcodeInfo> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(QrcodeInfo::getQrCode, qrCode);
        return baseMapper.selectOne(wrapper);
    }
}
